/*
 *  Licensed to the Apache Software Foundation (ASF) under one or more
 *  contributor license agreements.  See the NOTICE file distributed with
 *  this work for additional information regarding copyright ownership.
 *  The ASF licenses this file to You under the Apache License, Version 2.0
 *  (the "License"); you may not use this file except in compliance with
 *  the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */
/**
 * @author Pavel Dolgov
 */
package org.apache.harmony.awt.nativebridge.linux;


import org.apache.harmony.awt.nativebridge.*;

/**
 * This file has been generated by a program.
 *
 *
 */
public class Xft extends BasicLibWrapper {
    static Xft instance;

    public static synchronized Xft getInstance() {
        if (instance == null) {
            instance = new Xft();
        }
        return instance;
    }

    private Xft() {
        org.apache.harmony.awt.Utils.loadLibrary("X11Wrapper"); //$NON-NLS-1$
        init();
    }

    private static native void init();

    public final native void XftDrawDestroy(long draw);

    public final native int XftDrawSetClip(long draw, long r);

    public final int XftDrawSetClipRectangles(long draw, int xOrigin, int yOrigin, X11.XRectangle rects, int n) {
        long tmp_0 = rects == null ? 0 : rects.longLockPointer();
        int tmp_ret = XftDrawSetClipRectangles(draw, xOrigin, yOrigin, tmp_0, n);
        if (rects != null) {
            rects.unlock();
        }
        return tmp_ret;
    }
    public final native int XftDrawSetClipRectangles(long draw, int xOrigin, int yOrigin, long rects, int n);


    public static class FT_Vector extends CommonStructWrapper {

        public static final int sizeof = NativeBridge.is64 ? 16 : 8;

        FT_Vector(boolean direct) {
            super(sizeof, direct);
        }
        FT_Vector(VoidPointer base) {
            super(base);
        }
        FT_Vector(long addr) {
            super(addr);
        }
        public final void set_x(long val) {
            byteBase.setCLong(0, val);
        }
        public final long get_x() {
            return byteBase.getCLong(0);
        }
        public final void set_y(long val) {
            byteBase.setCLong(NativeBridge.is64 ? 8 : 4, val);
        }
        public final long get_y() {
            return byteBase.getCLong(NativeBridge.is64 ? 8 : 4);
        }
        public int size() {
            return sizeof;
        }
    }

    public final FT_Vector createFT_Vector(boolean direct) {
        return new FT_Vector(direct);
    }
    public final FT_Vector createFT_Vector(VoidPointer base) {
        return new FT_Vector(base);
    }
    public final FT_Vector createFT_Vector(long addr) {
        return new FT_Vector(addr);
    }


    public static class FT_Bitmap extends CommonStructWrapper {

        public static final int sizeof = NativeBridge.is64 ? 40 : 24;

        FT_Bitmap(boolean direct) {
            super(sizeof, direct);
        }
        FT_Bitmap(VoidPointer base) {
            super(base);
        }
        FT_Bitmap(long addr) {
            super(addr);
        }
        public final void set_rows(int val) {
            byteBase.setInt32(0, val);
        }
        public final int get_rows() {
            return byteBase.getInt32(0);
        }
        public final void set_width(int val) {
            byteBase.setInt32(4, val);
        }
        public final int get_width() {
            return byteBase.getInt32(4);
        }
        public final void set_pitch(int val) {
            byteBase.setInt32(8, val);
        }
        public final int get_pitch() {
            return byteBase.getInt32(8);
        }
        public final void set_buffer(Int8Pointer val) {
            byteBase.setPointer(NativeBridge.is64 ? 16 : 12, val);
        }
        public final Int8Pointer get_buffer() {
            return nb.createInt8Pointer(byteBase.getAddress(NativeBridge.is64 ? 16 : 12));
        }
        public final void set_num_grays(short val) {
            byteBase.setInt16(NativeBridge.is64 ? 24 : 16, val);
        }
        public final short get_num_grays() {
            return byteBase.getInt16(NativeBridge.is64 ? 24 : 16);
        }
        public final void set_pixel_mode(byte val) {
            byteBase.set(NativeBridge.is64 ? 26 : 18, val);
        }
        public final byte get_pixel_mode() {
            return byteBase.get(NativeBridge.is64 ? 26 : 18);
        }
        public final void set_palette_mode(byte val) {
            byteBase.set(NativeBridge.is64 ? 27 : 19, val);
        }
        public final byte get_palette_mode() {
            return byteBase.get(NativeBridge.is64 ? 27 : 19);
        }
        public final void set_palette(VoidPointer val) {
            byteBase.setPointer(NativeBridge.is64 ? 32 : 20, val);
        }
        public final VoidPointer get_palette() {
            return nb.createInt8Pointer(byteBase.getAddress(NativeBridge.is64 ? 32 : 20));
        }
        public int size() {
            return sizeof;
        }
    }

    public final FT_Bitmap createFT_Bitmap(boolean direct) {
        return new FT_Bitmap(direct);
    }
    public final FT_Bitmap createFT_Bitmap(VoidPointer base) {
        return new FT_Bitmap(base);
    }
    public final FT_Bitmap createFT_Bitmap(long addr) {
        return new FT_Bitmap(addr);
    }


    public static class FT_Outline extends CommonStructWrapper {

        public static final int sizeof = NativeBridge.is64 ? 40 : 20;

        FT_Outline(boolean direct) {
            super(sizeof, direct);
        }
        FT_Outline(VoidPointer base) {
            super(base);
        }
        FT_Outline(long addr) {
            super(addr);
        }
        public final void set_n_contours(short val) {
            byteBase.setInt16(0, val);
        }
        public final short get_n_contours() {
            return byteBase.getInt16(0);
        }
        public final void set_n_points(short val) {
            byteBase.setInt16(2, val);
        }
        public final short get_n_points() {
            return byteBase.getInt16(2);
        }
        public final Xft.FT_Vector get_points() {
            return Xft.instance.createFT_Vector(byteBase.getAddress(NativeBridge.is64 ? 8 : 4));
        }
        public final void set_tags(Int8Pointer val) {
            byteBase.setPointer(NativeBridge.is64 ? 16 : 8, val);
        }
        public final Int8Pointer get_tags() {
            return nb.createInt8Pointer(byteBase.getAddress(NativeBridge.is64 ? 16 : 8));
        }
        public final void set_contours(Int16Pointer val) {
            byteBase.setPointer(NativeBridge.is64 ? 24 : 12, val);
        }
        public final Int16Pointer get_contours() {
            return nb.createInt16Pointer(byteBase.getAddress(NativeBridge.is64 ? 24 : 12));
        }
        public final void set_flags(int val) {
            byteBase.setInt32(NativeBridge.is64 ? 32 : 16, val);
        }
        public final int get_flags() {
            return byteBase.getInt32(NativeBridge.is64 ? 32 : 16);
        }
        public int size() {
            return sizeof;
        }
    }

    public final FT_Outline createFT_Outline(boolean direct) {
        return new FT_Outline(direct);
    }
    public final FT_Outline createFT_Outline(VoidPointer base) {
        return new FT_Outline(base);
    }
    public final FT_Outline createFT_Outline(long addr) {
        return new FT_Outline(addr);
    }

}

